package br.edu.ifrn.sgpapp.util;

import java.util.Collection;

import android.widget.TextView;

public class ValidatorUtil {

	public static boolean isEmpty(Object obj) {
		if(obj == null)
			return true;
		if(obj instanceof CharSequence)
			return String.valueOf(obj).trim().equals("");
		if(obj instanceof TextView)
			return isEmpty(((TextView) obj).getText());
		if (obj instanceof Collection){
			return ((Collection<?>) obj).isEmpty();
		}
		
		return false;
	}
	
	public static boolean isNotEmpty(Object obj) {
		return !isEmpty(obj);
	}
}
